﻿Imports ValorYReferencia.Figuras
Imports System.Windows.Forms

Namespace Division
    Module PruebaDivision
        Sub Main()
            Dim dividendo As Integer
            Dim divisor As Integer

            dividendo = ObtenerValor("Ingrese el dividendo")

            Console.Write("Ingrese el divisor: ")
            divisor = CInt(Console.ReadLine())

            Console.WriteLine("El resultado es: {0}", dividendo / divisor)
            Console.ReadKey()
        End Sub

        Function ObtenerValor(ByVal mensaje As String) As Integer
            Dim ok As Boolean
            Dim result As Integer
            Do
                Try
                    Console.Write("Ingrese el dividendo: ")
                    result = CInt(Console.ReadLine())
                    ok = True
                Catch e As InvalidCastException
                    Console.WriteLine("El número ingresado no es correcto")
                End Try
            Loop While Not ok
            Return result
        End Function
    End Module
End Namespace